package site.sorghum.ddl.field;

import java.sql.JDBCType;

public class OracleTypeConvert extends BasicTypeConverter {
    public static final TypeConverter INSTANCE = new OracleTypeConvert();

    @Override
    public String convertToDatabaseType(JDBCType jdbcType) {
        if (jdbcType == null) {
            throw new IllegalArgumentException("JDBC type cannot be null");
        }

        switch (jdbcType) {
            case BOOLEAN:
            case BIT:
            case TINYINT:
            case SMALLINT:
            case INTEGER:
            case BIGINT:
            case FLOAT:
            case DOUBLE:
            case DECIMAL:
            case NUMERIC:
            case REAL:
                return "NUMBER";
            case LONGVARCHAR:
                return "CLOB";
            case LONGVARBINARY:
                return "BLOB";
            case TIME_WITH_TIMEZONE:
            case TIMESTAMP_WITH_TIMEZONE:
                return "TIMESTAMP WITH TIME ZONE";
            case TIMESTAMP:
                return "TIMESTAMP";
            default:
                return super.convertToDatabaseType(jdbcType);
        }
    }
}
